<template>
  <div class="popover-box">
    <span class="title">营销模式</span>
    <span class="block-text">店-人-货</span>
    <el-divider class="custom-divider" />
    <span class="block-text">店-货-人</span>

    <div class="row">
      <span class="label" :class="{ active: isPersonGoodsActive }">人-货</span>
      <el-checkbox v-model="checkedStore" label="门店" />
      <el-checkbox v-model="checkedMall" label="商城" />
    </div>

    <div class="row">
      <span class="label" :class="{ active: isGoodsPersonActive }">货-人</span>
      <el-checkbox v-model="checkedStores" label="门店" />
      <el-checkbox v-model="checkedMalls" label="商城" />
    </div>
  </div>
</template>

<script setup lang="ts">
import { ref, computed } from "vue";

const checkedStore = ref(false);
const checkedMall = ref(false);
const checkedStores = ref(false);
const checkedMalls = ref(false);

const isPersonGoodsActive = computed(
  () => checkedStore.value || checkedMall.value
);
const isGoodsPersonActive = computed(
  () => checkedStores.value || checkedMalls.value
);
</script>

<style>
.title {
  display: block;
  text-align: center;
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 0;
  line-height: 22.4px;
  color: rgba(10, 31, 55, 1);
  margin-bottom: 4px;
}

.block-text {
  display: block;
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0px;
  line-height: 19.6px;
  color: rgba(148, 158, 174, 1);
  margin-bottom: 4px;
}

.row {
  display: flex;
  align-items: center;
  margin-top: 6px;
}

.label {
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0px;
  line-height: 19.6px;
  color: rgba(148, 158, 174, 1);
  margin-right: 10px;
  transition: all 0.3s;
}

/* 选中时字体样式 */
.label.active {
  font-weight: 500;
  color: rgba(112, 135, 250, 1);
}

/* 未选中复选框字体样式 */
.el-checkbox .el-checkbox__label {
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0;
  line-height: 19.6px;
  color: rgba(10, 31, 55, 0.6);
  user-select: none;
}

/* 修改选中后字体颜色和样式 */
.el-checkbox.is-checked .el-checkbox__label {
  font-size: 14px !important;
  font-weight: 400 !important;
  letter-spacing: 0 !important;
  line-height: 19.6px !important;
  color: rgba(10, 31, 55, 1) !important;
}

/* 修改选中框边框和背景色为绿色 */
.el-checkbox.is-checked .el-checkbox__inner {
  border-color: #00c48f !important;
  background-color: #00c48f !important;
}

/* 鼠标悬停时边框颜色保持绿色 */
.el-checkbox:hover:not(.is-disabled) .el-checkbox__inner {
  border-color: #00c48f !important;
}
</style>
<style scoped>
.custom-divider {
  margin: 4px 0;
}
</style>
